package cn.z2huo.knowledge.designpattern.simplefactory.example2;

/**
 * 打折收费
 */
class CashRebate extends Cash {

    /**
     * 折数
     */
    private double moneyRebate = 1;

    public CashRebate(double moneyRebate) {
        this.moneyRebate = moneyRebate;
    }

    /**
     * 打折收费
     * @param money 原价
     * @return 打折后的价格
     */
    @Override
    double acceptCash(double money) {
        return money * moneyRebate;
    }
}
